<%--
    Document   : index
    Created on : 19 juin 2010, 23:51:05
    Author     : marya
--%>

<%@page contentType="text/xml" pageEncoding="UTF-8"%>
<%@page import="org.restlet.resource.ClientResource" %>
<%@page import="org.restlet.representation.Representation" %>
<%@page import="org.restlet.ext.xml.DomRepresentation" %>
<%@page import="org.w3c.dom.Element" %>
<%@page import="org.w3c.dom.Node" %>
<%@page import="org.w3c.dom.NodeList" %>
<%@page import="java.util.List" %>
<%@page import="xmlws.helpers.WebService" %>
<%





            request.setCharacterEncoding("UTF-8");
            response.setCharacterEncoding("UTF-8");
            ClientResource client = new ClientResource(WebService.federateur + "/contacts/" + request.getParameter("idContact") + "/hcard");
            if (request.getMethod().equals("GET")) {
                DomRepresentation representation = new DomRepresentation(client.get());
                NodeList elements = representation.getDocument().getElementsByTagName("hcard");
                if (elements.getLength() > 0) {
                    for (int i = 0; i < elements.getLength(); i++) {
                        Node node = elements.item(i);
                        out.println(node.getTextContent());
                    }
                }
                out.println("<br/><br/><a class='button' onclick=\"applyToModify_contact(" + request.getParameter("idContact") + ")\">Modifier</a>");
                out.println("<br/><br/><a class='button' onclick=\"delete_contact(" + request.getParameter("idContact") + " , " + request.getParameter("idGroupe") + ")\">Supprimer</a>");


            }else if (request.getMethod().equals("DELETE")) {
                    client.delete();
                    
                }









%>

